﻿using StardewValley;
using StardewValley.Monsters;
using System.Xml.Serialization;

namespace WorseGame.Content.怪物增强
{
    [XmlInclude(typeof(AngryRoger))]
    [XmlInclude(typeof(Bat))]
    [XmlInclude(typeof(BigSlime))]
    [XmlInclude(typeof(BlueSquid))]
    [XmlInclude(typeof(Bug))]
    [XmlInclude(typeof(DinoMonster))]
    [XmlInclude(typeof(Duggy))]
    [XmlInclude(typeof(DustSpirit))]
    [XmlInclude(typeof(DwarvishSentry))]   
    [XmlInclude(typeof(Ghost))]    
    [XmlInclude(typeof(HotHead))]
    [XmlInclude(typeof(LavaLurk))]
    [XmlInclude(typeof(Leaper))]
    [XmlInclude(typeof(MetalHead))]
    [XmlInclude(typeof(Mummy))]
    [XmlInclude(typeof(RockCrab))]
    [XmlInclude(typeof(RockGolem))]
    [XmlInclude(typeof(Serpent))]
    [XmlInclude(typeof(ShadowBrute))]
    [XmlInclude(typeof(ShadowGirl))]
    [XmlInclude(typeof(ShadowGuy))]
    [XmlInclude(typeof(ShadowShaman))]
    [XmlInclude(typeof(Shooter))]
    [XmlInclude(typeof(Skeleton))]
    [XmlInclude(typeof(Spiker))]
    [XmlInclude(typeof(SquidKid))]
    public class 史莱姆增强器 : 怪物增强器
    {
        public override void 应用增强(Monster 怪物)
        {
            GreenSlime 史莱姆 = (GreenSlime)怪物;
            if (史莱姆 != null)
            {
                史莱姆.speed = 史莱姆.speed * 2;
                float 增强系数 = 1.2f;
                史莱姆.MaxHealth = (int)(史莱姆.MaxHealth * 增强系数);
                if (史莱姆.Health > 0)
                {
                    史莱姆.Health = (int)(史莱姆.Health * 增强系数);
                }
                史莱姆.resilience.Value = (int)(史莱姆.resilience.Value * 增强系数);
                史莱姆.DamageToFarmer = (int)(史莱姆.DamageToFarmer * 1.1f);
                if (Game1.random.NextDouble() < 0.15 && 史莱姆.readyToJump <= 0)
                {
                    史莱姆.readyToJump = 1;
                }
            }
        }
    }
}
